package com.qeegoo.b2bautozityp.moudle.good.adapter;

import com.chad.library.adapter.base.BaseSectionQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.qeegoo.b2bautozityp.R;
import com.qeegoo.b2bautozityp.moudle.good.entity.MySection;
import com.qeegoo.b2bautozityp.moudle.good.model.CarModelOneBean;

import java.util.List;

/**
 * 王少岩 在 2017/9/20 创建了它
 */

public class CarModelOneAdapter extends BaseSectionQuickAdapter<MySection<CarModelOneBean.CarSeriesVo>, BaseViewHolder> {
    /**
     * Same as QuickAdapter#QuickAdapter(Context,int) but with
     * some initialization data.
     *
     * @param data A new list is created out of this one to avoid mutable list
     */
    public CarModelOneAdapter(List<MySection<CarModelOneBean.CarSeriesVo>> data) {
        super(R.layout.adapter_goods_carmodel_item_1, R.layout.adapter_goods_carmodel_item_0, data);
    }

    @Override
    protected void convertHead(BaseViewHolder holder, MySection item) {
        holder.setText(R.id.tv_header, item.header);
    }

    @Override
    protected void convert(BaseViewHolder holder, MySection<CarModelOneBean.CarSeriesVo> item) {
        holder.setText(R.id.tv_subtitle, item.t.seriesName);
        holder.setVisible(R.id.iv_selected, item.t.isSelected);
        holder.setTextColor(R.id.tv_subtitle, item.t.isSelected ? mContext.getResources().getColor(R.color.blue) : mContext.getResources().getColor(R.color.text_normal));
    }
}
